package com.ruoyi.system.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.ZtfCodeNc;
import com.ruoyi.system.domain.dto.CodeDTO;
import com.ruoyi.system.service.IZtfAppCodeNcService;
import com.ruoyi.system.service.IZtfCodeNcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 激活码，可短信发出或线下发给Controller
 * 
 * @author ruoyi
 * @date 2025-05-30
 */
@RestController
@RequestMapping("app/system/nc")
@Api(tags = "APP激活码相关接口")
public class ZtfAppCodeNcController extends BaseController
{
    @Autowired
    private IZtfAppCodeNcService ztfAppCodeNcService;

    @PutMapping("/edit")
    @ApiOperation("激活码激活接口")
   public AjaxResult editCode(@RequestBody CodeDTO codeDTO){
        //获取手机号
       String xphone=codeDTO.getXphone();
        //获取激活码
        String codeName=codeDTO.getCodeName();
        //拿到用户id
        Long userId=SecurityUtils.getUserId();
       return toAjax(ztfAppCodeNcService.editCode(xphone,codeName,userId));
   }
}
